<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
    <title>学工服务</title>
    <link href="http://117.169.48.109:8089/css/base.css" rel="stylesheet" />
    <link href="http://117.169.48.109:8089/css/default/DEKT.css" rel="stylesheet" />
    <link href="http://117.169.48.109:8089/layui/css/layui.css" rel="stylesheet" />
    <link href="http://117.169.48.109:8089/css/mobiscroll.custom-2.5.0.min.css" rel="stylesheet" />
    <link href="http://117.169.48.109:8089/css/themes/default/easyui.css" rel="stylesheet" />
    <link href="http://117.169.48.109:8089/css/themes/icon.css" rel="stylesheet" />
    <script src="http://117.169.48.109:8089/js/newjs/jquery-3.1.1.min.js"></script>
    <script src="http://117.169.48.109:8089/layui/layui.all.js"></script>
    <script src="http://117.169.48.109:8089/js/Public/mobiscroll.custom-2.5.0.min.js?v=1.0.0"></script>
    <script src="http://117.169.48.109:8089/js/Public/PublicGetUrlParam.js"></script>
    <script src="http://117.169.48.109:8089/js/FWDT/My97DatePicker/WdatePicker.js"></script>
    <script src="http://117.169.48.109:8089/js/hdj_default/easyui-lang-zh_CN.js"></script>
    <script src="http://117.169.48.109:8089/js/hdj_default/jquery.easyui.min.js"></script>
    <style>

        .tab-content1 {
            background-color: #fff;
            padding: 10px 4%;
        }

            .tab-content1 .tab2 {
                display: none
            }

            .tab-content1 > div {
                width: 100%;
            }

            .tab-content1 .tab1-bt {
                width: 100%;
                padding: 10px 3%;
                box-sizing: border-box;
                box-shadow: 1px 1px 2px 1px #eee;
                border-radius: 6px;
            }

                .tab-content1 .tab1-bt .tab1-bt-title {
                    font-size: 16px;
                    padding: 10px 0;
                    font-weight: bold;
                }

                .tab-content1 .tab1-bt input {
                    width: 100%;
                    height: 32px;
                    line-height: 32px;
                }

                    .tab-content1 .tab1-bt input[type="radio"] {
                        width: 16px;
                        height: 16px;
                        line-height: 16px;
                    }

                    .tab-content1 .tab1-bt input[type="checkbox"] {
                        width: 16px;
                        height: 16px;
                        line-height: 16px;
                    }

                .tab-content1 .tab1-bt select {
                    width: 100%;
                    height: 32px;
                    line-height: 32px;
                }

                .tab-content1 .tab1-bt textarea {
                    width: 100%;
                    height: 100px;
                    border: none;
                }

            .tab-content1 .btn-next {
                width: 92%;
                height: 36px;
                line-height: 36px;
                margin: 15px 4%;
                border-radius: 6px;
                text-align: center;
                color: #fff;
                margin-top: 30px;
                background-color: #ff6501;
            }

        p button {
            width: 60%;
            height: 30px;
            line-height: 30px;
            margin: 1px 20%;
            border-radius: 6px;
            text-align: center;
            color: #fff;
            margin-top: 0;
            background-color: #ff6501;
        }

        /*p {
            margin: 0px;
            line-height: 25px;
        }
        input, select, textarea {
            border: 1px solid #95b8e7;
        }*/
        td p {
            margin: 0px;
            line-height: 25px;
        }
        /*分移动端和pc端html pc端html则加上该样式*/
        .control {
            border: 1px solid #95b8e7;
        }

        /*图片上传*/
        .imgUpfile {
            float: left;
            margin-left: 10px;
            margin-bottom: 5px;
        }

            .imgUpfile > span {
                display: block;
                width: 50px;
                height: 21px;
                border-radius: 5px;
                background-color: #e31616;
                margin: 4px auto;
                line-height: 21px;
                color: white;
                text-align: center;
            }

            .imgUpfile > div {
                width: 100%;
                height: 90px;
                border: 1px solid #ccc;
            }

                .imgUpfile > div > p {
                    font-size: 35px;
                    line-height: 83px;
                    text-align: center;
                    vertical-align: middle;
                }
        /*文件上传*/
        .spanUpFile {
            padding: 6px 28px;
            border: 2px solid #b7d2ff;
            border-radius: 10px;
            background-color: #e0ecff;
            font-size: 14px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <input type="file" id="headPortraitUpload" accept="image/*" style="display: none">
    <input type="file" id="headPortraitUpload_upfile" accept="image/*" multiple style="display: none">
    <!--顶部返回按钮区域-->
    <section class="top">
        <!--<a href="javascript:window.history.go(-1)" class="back"></a>-->
        <a href="javascript:Back();" class="back"></a>
        <p class="top-text"><span id="Title">事务中心</span></p>
    </section>
    <section class="tab-title">
        <span class="on">事务申请</span>
        <span>申请记录</span>
    </section>
    <section class="tab-content1" style="margin-top:0;">
        <div class="tab1" id="tab1">
            <div id="table1_content" style="width:100%;overflow:auto;background-color:white;">
                <div id="div_panel"></div>
            </div>
        </div>
        <div class="tab2">
            <div class="hdlb-list" id="divHDLB">
               
                <!--<div class="hdlb-content clearfix">
        <div class="hdlb-left fl">
            <p class="hdlb-left-title">图书馆清理活动</p>
            <p class="hdlb-left-nr hdlb-left-nr1"><span>分类:</span></p>
            <p class="hdlb-left-nr hdlb-left-nr1"><span>成员:5人</span></p>
            <p class="hdlb-left-nr hdlb-left-nr1"><span>星级：<span class="star123" data-num="4"></span></span></p>
            <p class="hdlb-left-nr"><span>院系:<span class="hdlb-left-sh">文法学院</span></span></p>
        </div>
        <div class="hdlb-right hdlb-right1 fr">
            <img src="../images/back.png" />
        </div>
    </div>-->
            </div>
            <div style="text-align:center;font-size:12px;" id="moreA"><a style="color: #808080;" href="javascript:LoadMore()">查看更多</a></div>
        </div>
    </section>
    <section class="tab-content1" style="margin-top:0;display:none;" id="sectionSHYJ">
        <div class="tab2">
            <div class="hdlb-list" id="divSHYJ">

            </div>
        </div>
    </section>
    <!--学生选择-->
    <div id="SaveChoiseXS"></div>
    <script>
        try {
            (function ($) {
                var oldHTML = $.fn.html;
                $.fn.formhtml = function () {
                    var sAgent = navigator.userAgent.toLowerCase();
                    if (/*@cc_on!@*/false && sAgent.indexOf("mac") == -1) {
                        return this[0].innerHTML;
                    }
                    if (arguments.length) return oldHTML.apply(this, arguments);
                    $("input,textarea,button", this).each(function () {
                        if (this.tagName.toLowerCase() == 'textarea')
                            this.innerText = this.value;
                        this.setAttribute('value', this.value);
                    });
                    $(":radio,:checkbox", this).each(function () {
                        if (this.checked) this.setAttribute('checked', 'checked');
                        else this.removeAttribute('checked');
                    });
                    $("option", this).each(function () {
                        if (this.selected) this.setAttribute('selected', 'selected');
                        else this.removeAttribute('selected');
                    });
                    return oldHTML.apply(this);
                };
            })(jQuery);
        } catch (e) {
        }

        ////参数
        //var urls = location.search.split('&');
        //var PDLXID = urls[0].split('=')[1];//评定类型id
        //var PDLXMC = unescape(urls[1].split('=')[1]);//评定类型名称
        //var KZDM = "";//任务进来有值
        //if (urls.length >2) {
        //    KZDM = urls[2].split('=')[1];
        //}
        //var isContinue = false;//不是从XGFW_XSXQ 返回来的
        //if (urls.length >3) {
        //    isContinue = urls[3].split('=')[1];
        //}

        //参数
        var UserAgent = "Mobile";//pc端和移动端 默认为移动端
        if (GetUrlParam("UserAgent") != "") {
            UserAgent = GetUrlParam("UserAgent");//服务大厅 pc端和移动端
        }
        var PDLXID = GetUrlParam("PDLXID");//评定类型id
        var PDLXMC = unescape(GetUrlParam("PDLXMC"));//评定类型名称
        var KZDM = GetUrlParam("KZDM");//任务进来有值
        var isContinue = false;//不是从XGFW_XSXQ 返回来的
        if (GetUrlParam("isContinue") == "1") {
            isContinue = true;
        }
        $("#Title").html(PDLXMC);//标题

        var UserType = "student";//用户类型
        var KXZD = "";//可选字段
        var TJZD = "";//条件字段
        var Create_BillCode = "";
        $(function () {
            var v_width = $(document.body).width();
            var v_height = $(window).height();
            $("#table1_content").height(v_height - 210);
            $(".select_textul").width(v_width);
            $(".tab-title>span").each(function (i) {
                $(this).click(function () {
                    if (UserType == "student" || UserType == "teacher") {
                        $(".tab-title>span").removeClass("on");
                        $(this).addClass("on");
                        $("div[class^='tab']").hide();
                        $("div[class='tab" + (i + 1) + "']").show();
                        if (i == 1) {
                            LoadSW();
                            currectPage = 1;
                        } else {
                            LoadHtml(PDLXID);
                        }
                    } else {
                        if (i == 0) {
                            LoadHtml(PDLXID);
                        }
                    }
                })
            })

            if (!isContinue) {//不是从XGFW_XSXQ 返回来的
                LoadHtml(PDLXID);
            } else {
                LoadSW();
                currectPage = 1;

                $(".tab-title>span").eq(1).click();
                //$(".tab-title>span").removeClass("on");
                //$(".tab-title>span").eq(1).addClass("on");
                //$("div[class^='tab']").hide();
                //$("div[class='tab2']").show();
            }
        })
        var phone = /^1(3|4|5|6|7|8|9)\d{9}$/;
        var number = /^\d{1,}$/;
        var email = /^[0-9]{6}$/;
        //加载填写的html
        function LoadHtml(PDLXID) {
            $.ajax({
                url: '../json/1.json',
                type: 'get',
                data: { PDLXID: PDLXID, KZDM: KZDM, UserAgent: UserAgent },
                dataType: 'json',
                success: function (data) {
                    //$(".tab1").html(data.rows[0].html);
                    $("#div_panel").html(data.rows[0].html);
                    el = document.querySelector("#div_panel");
                    START_X = Math.round((window.innerWidth - el.offsetWidth - 100) / 2);
                    START_Y = Math.round((window.innerHeight - el.offsetHeight - 100) / 2);
                    resetElement();
                    if (!$("#btnNext").length > 0) {
                        $(".tab1").append('<button class="btn-next" id="btnNext" onclick="Submit()">送审</button>');
                    }
                    KXZD = data.rows[0].kxzd;
                    TJZD = data.rows[0].tjzd;
                    Create_BillCode = data.rows[0].Create_BillCode;
                    if (data.rows[0].isQY == "false") {
                        $("#btnNext").prop("disabled", true);
                        $("#btnNext").css("background-color", "#888");
                    }
                    UserType = data.rows[0].UserType;//用户类型
                    var myscript = document.createElement("script");//判定规则
                    myscript.type = "text/javascript";
                    myscript.innerText = "function checkHtml(){"
                        + " var isok = true;"
                        + data.rows[0].cxcy_gzpddm
                        + " return isok;"
                        + "}";
                    $("body").append(myscript);

                    //根据pc或移动加载控件事件
                    if (UserAgent == "PC") {
                        disabledTrue_PC();  //pc端禁用  与加样式
                    } else {
                        //日期控件
                        var curr = new Date().getFullYear();
                        var month = new Date().getMonth();
                        var day = new Date().getDate();
                        $("input[zx^=rqkj_]").each(function myfunction() {
                            var zx = $(this).attr("zx").split('_')[1];
                            var zxs = zx.split(' ');// yyyy-MM-dd    HH:mm
                            var dateFormat = zxs[0].toLowerCase();
                            var timeFormat = "";// "HH:ii"
                            if (zxs.length == 1) {
                                timeFormat = "";
                            } else {
                                timeFormat = zxs[1].replace('mm', 'ii');
                            }

                            $(this).mobiscroll().datetime({
                                theme: 'android-ics light',
                                mode: 'scroller',
                                display: 'bottom',
                                lang: 'zh',
                                setText: '确定',
                                cancelText: '取消',
                                dayText: '日',
                                monthText: '月',
                                yearText: '年',
                                hourText: '时',
                                minuteText: '分',
                                startYear: curr - 10,
                                endYear: curr + 10,
                                timeFormat: timeFormat,
                                timeWheels: timeFormat,
                                dateFormat: dateFormat,
                                dateOrder: 'yymmdd'
                            });
                        })

                        disabledTrue_Mobile();//pc端禁用
                    }
                    //院系 年级 专业 班级联动
                    LoadSelect();
                }
            });
        }
        //院系 年级 专业 班级联动
        function LoadSelect() {
            $(".tab1 select[controlId='yx']").each(function (index, value) {
                var currentValue = $(value).attr("currentValue");
                $.ajax({
                    type: "POST",
                    url: "http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=LoadSelect",
                    data: {
                        selectType: "yx",
                        currentValue: currentValue
                    },
                    dataType: "text",
                    success: function (data) {
                        $(value).html(data);
                    }
                });
            })
            $(".tab1 select[controlId='nj']").each(function (index, value) {
                var currentValue = $(value).attr("currentValue");
                $.ajax({
                    type: "POST",
                    url: "http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=LoadSelect",
                    data: {
                        selectType: "nj",
                        currentValue: currentValue
                    },
                    dataType: "text",
                    success: function (data) {
                        $(value).html(data);
                    }
                });
            })
        }
        //改变事件
        function SelectChange(obj) {
            var newcurrentValue = $(obj).val();
            $(obj).attr("currentValue", newcurrentValue);

            var selectType = $(obj).attr("controlId");
            if (selectType == "yx" || selectType == "nj") {
                var yx = $(".tab1 select[controlId='yx']").val();
                var nj = $(".tab1 select[controlId='nj']").val();
                if (yx != "0" && nj != "0") {
                    var currentValue = $(".tab1 select[controlId='zy']").attr("currentValue");
                    $.ajax({
                        type: "POST",
                        url: "http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=LoadSelect",
                        data: {
                            selectType: "zy",
                            currentValue: currentValue,
                            yx: yx,
                            nj: nj
                        },
                        dataType: "text",
                        success: function (data) {
                            $(".tab1 select[controlId='zy']").html(data);
                            $(".tab1 select[controlId='bj']").html("<option value=\"0\" text=\"请选择\">请选择</option>");
                        }
                    });
                }
            } else if (selectType == "zy") {
                var zy = $(".tab1 select[controlId='zy']").val();
                if (yx != "0" && nj != "0") {
                    var currentValue = $(".tab1 select[controlId='bj']").attr("currentValue")
                    $.ajax({
                        type: "POST",
                        url: "http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=LoadSelect",
                        data: {
                            selectType: "bj",
                            currentValue: currentValue,
                            zy: zy
                        },
                        dataType: "text",
                        success: function (data) {
                            $(".tab1 select[controlId='bj']").html(data);
                        }
                    });
                }
            }

        }
        //pc端禁用  与加样式
        function disabledTrue_PC() {
            $(".tab1 input").each(function (index, value) {
                $(value).addClass("control"); //样式
                if (KXZD.indexOf($(value).attr("name")) < 0) {
                    value.disabled = true;
                } else {
                    value.disabled = false;
                }
            })
            $(".tab1 textarea").each(function (index, value) {
                $(value).addClass("control"); //样式
                if (KXZD.indexOf($(value).attr("name")) < 0) {
                    value.disabled = true;
                } else {
                    value.disabled = false;
                }
            })
            $(".tab1 select").each(function (index, value) {
                $(value).addClass("control"); //样式
                if (KXZD.indexOf($(value).attr("name")) < 0) {
                    value.disabled = true;
                } else {
                    value.disabled = false;
                }
            })
        }
        //pc端禁用
        function disabledTrue_Mobile() {
            $(".tab1 input").each(function (index, value) {
                if (KXZD.indexOf($(value).attr("name")) < 0) {
                    value.disabled = true;
                } else {
                    value.disabled = false;
                }

                if ($(value).attr("zx") != null) {
                    $(value).attr("placeholder", "请选择日期") //加提示
                } else {
                    $(value).attr("placeholder", "请输入...")  //加提示
                }
            })
            $(".tab1 textarea").each(function (index, value) {
                if (KXZD.indexOf($(value).attr("name")) < 0) {
                    value.disabled = true;
                } else {
                    value.disabled = false;
                }
                $(value).attr("placeholder", "请输入...")  //加提示
            })
            $(".tab1 select").each(function (index, value) {
                if (KXZD.indexOf($(value).attr("name")) < 0) {
                    value.disabled = true;
                } else {
                    value.disabled = false;
                }
            })
        }
        //将控件解禁
        function disabledFalse() {
            $(".tab1 input").each(function (index, value) {
                if (value.name != "xsdm") {//学生选择文本框
                    value.disabled = false;
                }
                $(value).removeAttr("placeholder");//提示内容
                $(value).removeClass("control");//样式
            })
            $(".tab1 select").each(function (index, value) {
                value.disabled = false;
                $(value).removeClass("control");//样式
            })
            $(".tab1 textarea").each(function (index, value) {
                value.disabled = false;
                $(value).removeAttr("placeholder");//提示内容
                $(value).removeClass("control");//样式
            })
        }
        //保存填写的html
        function Submit() {
            var isok = IsOK(); //判断是否必填
            if (!isok) {
                return false;
            }
            isok = checkHtml();//判定规则
            if (!isok) {
                return false;
            }
            disabledFalse();

            if (isok) {

                var dataString = {
                    html: encodeURI(html), PDLXID: PDLXID, KXZD: KXZD, TJZD: TJZD, Create_BillCode: Create_BillCode, IsSave: "1", KZDM: KZDM, UserAgent: UserAgent
                }
                $(".imgUpfile input[type='hidden']").each(function (i, v) {
                    dataString[v.attributes["name"].value] = v.value;
                    v.value = '';
                })
                $(".imgUpfile img").each(function (i, v) {
                    v.src = '';
                })
                //清空文件上传控件模式3内容
                $("span[names='文件上传']").each(function (i, v) {
                    var row = v.attributes["row"].value;
                    var name = v.attributes["name"].value;
                    if (document.getElementById('name + "_" + row'))
                        $("#" + name + "_" + row).html("");
                })
                var html = $(document.getElementById("div_panel")).formhtml();
                dataString["html"] = encodeURI(html);
                $.ajax({
                    type: "POST",
                    data: dataString,
                    url: 'http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=SaveData',
                    dataType: "text",
                    async: false,
                    beforeSend: function () {
                        $("#btnNext").text('送审中...');
                        $("#btnNext").attr('disabled', 'disabled');
                    },
                    complete: function () {
                        $("#btnNext").text('送审');
                        $("#btnNext").removeAttr('disabled');
                    },
                    success: function (data) {
                        if (data == "noTime") {
                            alert("申请已结束！");
                            if (UserAgent == "PC") {
                                disabledTrue_PC();//禁用与加样式
                            } else {
                                disabledTrue_Mobile();
                            }
                        } else if (data == "KNRD") {
                            alert("你不是贫困生，无暂不能参加！");
                        } else if (data == "more") {
                            alert("申请已达到最高次数！");
                            if (UserAgent == "PC") {
                                disabledTrue_PC();//禁用与加样式
                            } else {
                                disabledTrue_Mobile();
                            }
                        } else if (data == "ok") {
                            alert("送审成功!");
                            //setTimeout(function () {
                            //    LoadHtml(PDLXID);
                            //}, 1500)
                            setTimeout(function () {
                                if (UserType == "student") {
                                    $(".tab-title>span").eq(1).click();
                                } else {
                                    $(".tab-title>span").eq(0).click();
                                }
                            }, 500)
                        } else {
                            var datajson = JSON.parse(data);
                            if (datajson.statue == "no" && datajson.msg != "") {
                                alert(datajson.msg);
                            } else {
                                alert("送审失败!");
                            }
                            $("#btnNext").text('送审');
                            $("#btnNext").removeAttr('disabled');
                            if (UserAgent == "PC") {
                                disabledTrue_PC();//禁用与加样式
                            } else {
                                disabledTrue_Mobile();
                            }
                        }
                    },
                    error: function () {
                        $("#btnNext").text('送审');
                        $("#btnNext").removeAttr('disabled');
                    }
                });
            } else {
                if (UserAgent == "PC") {
                    disabledTrue_PC();//禁用与加样式
                } else {
                    disabledTrue_Mobile();
                }
            }
        }
        //必填
        function IsOK() {
            var isok = true;

            if (isok) {
                $(".tab1 input[type='text'][sfbt='0'][disabled!='disabled']").each(function (i, v) {

                    if (v.value.trim() == "") {
                        alert($(v).attr("names") + " ,不能为空!");
                        isok = false;
                        return false;
                    }
                    var isnum = $(v).attr("isnum");
                    if (isnum == '1') {
                        if (isNaN(v.value)) {
                            alert($(v).attr("names") + " ,必须为数字!");
                            v.focus();
                            isok = false;
                            return false;
                        }
                    }
                })
            }
            if (isok) {
                $(".tab1 input[type='radio'][sfbt='0'][disabled!='disabled']").each(function (i, v) {
                    if ($("input[type='radio'][name='" + $(v).attr("name") + "']:checked").length == 0) {
                        alert($(v).attr("names") + " ,请勾选!");
                        isok = false;
                        return false;
                    }
                })
            }
            if (isok) {
                $(".tab1 input[type='checkbox'][sfbt='0'][disabled!='disabled']").each(function (i, v) {
                    if ($("input[type='checkbox'][name='" + $(v).attr("name") + "']:checked").length == 0) {
                        alert($(v).attr("names") + " ,请勾选!");
                        isok = false;
                        return false;
                    }
                })
            }
            if (isok) {
                $(".tab1 select[sfbt='0'][disabled!='disabled']").each(function (i, v) {
                    if (v.value == "0" || v.value == "请选择") {
                        alert($(v).attr("names") + " ,请选择!");
                        isok = false;
                        return false;
                    }
                })
            }
            if (isok) {
                $(".tab1 textarea[sfbt='0'][disabled!='disabled']").each(function (i, v) {
                    if (v.value.trim() == "") {
                        alert($(v).attr("names") + " ,不能为空!");
                        isok = false;
                        return false;
                    }
                })
            }

            return isok;
        }
        var layerOpen;
        //文件上传
        function UpFile(obj) {
            var row = $(obj).attr('row');
            var model = $(obj).attr("model");//文件上传模式  1：直接上传文件，2：查看并上传,3：直接批量选择
            wRow = row;
            wModel = model;
            var theName = $(obj).attr("name");
            wDivList = theName + "_" + row;
            if (model == "3") {
                UpFile_ChooseImage(wDivList);
                return false;
            }
            layerOpen = layer.open({
                type: 2,
                title: "文件上传",
                //skin: 'layui-layer-rim', //加上边框
                area: ['90%', '80%'], //宽高
                content: 'XGFW_UpFile.html?Create_BillCode=' + Create_BillCode + '&row=' + row + '&XSDM='
            });
        }
        $("#headPortraitUpload_upfile").change(function () {
            cur_upFileIndex = 0;
            Fun_ChooseImgSetFileList(this.files);
        })
        //文件上传-模式3
        function UpFile_ChooseImage(imgDivName) {
            document.getElementById("headPortraitUpload_upfile").click();
        }
        //接收上传成功后的返回值-模式3
        var cur_upFileIndex = 0;
        function Fun_ChooseImgSetFileList(uploadfils_infolist) {
            if (cur_upFileIndex < uploadfils_infolist.length) {
                var row = wRow;
                var filename = uploadfils_infolist[cur_upFileIndex].name;
                if (window.FileReader) {
                    var fileReader = new FileReader();
                    fileReader.readAsDataURL(uploadfils_infolist[cur_upFileIndex]);
                    fileReader.onloadend = function (e) {
                        var base64 = fileReader.result;

                        $.ajax({
                            url: "http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=UpFile",
                            type: "post",
                            data: {
                                path: base64, row: row, Create_BillCode: Create_BillCode, name: filename, isbase64: 1
                            },
                            dataType: 'json',
                            async: false,
                            success: function (va) {
                                var strImage = '<div class="imgUpfile" style="width:90px;height:115px;margin-top:10px;">';
                                strImage += '<div><p><img src="' + base64 + '" onclick="upfile_PreviewPic(this)" width="90px" height="88px"></p></div ><span onclick="imgDel_Upfile(\'' + va.id + '\',this)">删除</span></div >';
                                $("#" + wDivList).append(strImage);

                                cur_upFileIndex++;
                                Fun_ChooseImgSetFileList(uploadfils_infolist);
                            }
                        })
                    }
                }
            } else {
                document.getElementById("headPortraitUpload_upfile").value = '';
            }

        }
        //图片删除-模式3
        function imgDel_Upfile(id, obj) {
            //执行删除
            var XSDM = GetUrlParam("XSDM");//判断是否是老师
            if (XSDM == "") {
                if (confirm("你确定删除？")) {
                    $.post("http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=DeleteFile", { id: id }, function (isDel) {
                        //LoadFiles();//加载表格

                        alert(isDel);
                        if (wModel == '1' || wModel == '3')
                            obj.parentNode.remove();
                        else {
                            $('#dg_UpFlie').datagrid('reload');
                        }

                    })
                }
            } else {
                alert("暂无权限删除");
            }
        }
        function CloseOpen() {
            layer.close(layerOpen);
        }
        //加载事务
        var currectPage = 1;//当前页
        var totalPage = 1;//总页数
        function LoadSW() {

            $.ajax({
                url: '../json/2.json',
                type: 'get',
                data: { currectPage: currectPage, PDLXID: PDLXID },
                dataType: 'json',
                success: function (data) {
                    if (data.total > 0) {
                        var winshid = "SaveSH";
                        var html = '';
                        var SHJGHTML = "";
                        if (data.total % 6 > 0) {
                            totalPage = parseInt(data.total / 6) + 1;
                        } else {
                            totalPage = parseInt(data.total / 6);
                        }
                        for (var i = 0; i < data.rows.length; i++) {
                            if (data.rows[i].SHZT == "2") {
                                SHJGHTML = "<span style=\"color:red;\">" + data.rows[i].SHZTNAME + "</span>";
                            } else {
                                SHJGHTML = "<span class=\"hdlb-left-sh\">" + data.rows[i].SHZTNAME + "</span>";
                            }
                            html += "<div class=\"hdlb-content clearfix\">";
                            html += "<div class=\"hdlb-left fl\" style=\"width:100%;\"> <p class=\"hdlb-left-title\"><a href=\"javascript:OpenHTML('0','" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "','" + data.rows[i].XSDM + "','" + data.rows[i].IsFQR + "','" + data.rows[i].SHZT + "','0')\">" + data.rows[i].DJLX + "</a></p><input class=\"fl\" type=\"button\"onclick=\"DeleteSW('" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "','" + data.rows[i].ISXGFW + "')\" id=\"del\" value=\"删除\" style=\"margin-left:240px;margin-top:-20px;color:white;background-color:#DD4B58;width:35px;\" />";
                            html += "<p class=\"hdlb-left-nr\" style=\"width:100%;\"><span>申请时间:" + data.rows[i].SQSJ + "</span></p>";
                            html += "<p class=\"hdlb-left-nr\" style=\"width:100%;\"><span>申请人:" + data.rows[i].XM + "</span></p> <p class=\"hdlb-left-nr\" style=\"width:100%;\"></p> <p class=\"hdlb-left-nr\" style=\"width:100%;\"><span>当前审批人:" + data.rows[i].DQSHR + "</span>";
                            /*html += "<span>当前步骤:" + data.rows[i].DQSHBZ + "</span ></p> <p class=\"hdlb-left-nr\" onclick=\"OpenSHYJ('" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "')\">" + SHJGHTML + "</p><p><button onclick=\"DeleteSW('" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "','" + data.rows[i].ISXGFW + "')\">删除</button></p></div>";*/

                            if (data.rows[i].IsFQR != "1") {
                                html += "<span>当前步骤:" + data.rows[i].DQSHBZ + "</span ></p> <p class=\"hdlb-left-nr\" onclick=\"OpenSHYJ('" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "')\">" + SHJGHTML + "</p></div>";
                                html += " </div>";
                            } else {
                                var textHtml = "送审";
                                if (data.rows[i].DQSHBZ != "开始") {
                                    textHtml = data.rows[i].DQSHBZ;
                                }
                                html += "<span>当前步骤:" + data.rows[i].DQSHBZ + "</span ></p> <p class=\"hdlb-left-nr\" onclick=\"OpenSHYJ('" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "')\">" + SHJGHTML + "</p><p><button onclick=\"OpenHTML('0','" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "','" + data.rows[i].XSDM + "','" + data.rows[i].IsFQR + "','" + data.rows[i].SHZTNAME + "','0')\">" + textHtml + "</button></p></div>";
                                html += " </div>";
                            }

                        }
                        $("#divHDLB").html(html);
                        $("#moreA").show();
                    } else {
                        $("#divHDLB").html("<h1 style='font-size: 18px; color:red;text-align: center;'>暂无数据！</h1>");
                        $("#moreA").hide();
                    }
                }
            });
        }
        function 删除后的事务() {

            $.ajax({
                url: '../json/删除后的事务.json',
                type: 'get',
                data: { currectPage: currectPage, PDLXID: PDLXID },
                dataType: 'json',
                success: function (data) {
                    if (data.total > 0) {
                        var winshid = "SaveSH";
                        var html = '';
                        var SHJGHTML = "";
                        if (data.total % 6 > 0) {
                            totalPage = parseInt(data.total / 6) + 1;
                        } else {
                            totalPage = parseInt(data.total / 6);
                        }
                        for (var i = 0; i < data.rows.length; i++) {
                            if (data.rows[i].SHZT == "2") {
                                SHJGHTML = "<span style=\"color:red;\">" + data.rows[i].SHZTNAME + "</span>";
                            } else {
                                SHJGHTML = "<span class=\"hdlb-left-sh\">" + data.rows[i].SHZTNAME + "</span>";
                            }
                            html += "<div class=\"hdlb-content clearfix\">";
                            html += "<div class=\"hdlb-left fl\" style=\"width:100%;\"> <p class=\"hdlb-left-title\"><a href=\"javascript:OpenHTML('0','" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "','" + data.rows[i].XSDM + "','" + data.rows[i].IsFQR + "','" + data.rows[i].SHZT + "','0')\">" + data.rows[i].DJLX + "</a></p><input class=\"fl\" type=\"button\"onclick=\"DeleteSW('" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "','" + data.rows[i].ISXGFW + "')\" id=\"del\" value=\"删除\" style=\"margin-left:240px;margin-top:-20px;color:white;background-color:#DD4B58;width:35px;\" />";
                            html += "<p class=\"hdlb-left-nr\" style=\"width:100%;\"><span>申请时间:" + data.rows[i].SQSJ + "</span></p>";
                            html += "<p class=\"hdlb-left-nr\" style=\"width:100%;\"><span>申请人:" + data.rows[i].XM + "</span></p> <p class=\"hdlb-left-nr\" style=\"width:100%;\"></p> <p class=\"hdlb-left-nr\" style=\"width:100%;\"><span>当前审批人:" + data.rows[i].DQSHR + "</span>";
                            /*html += "<span>当前步骤:" + data.rows[i].DQSHBZ + "</span ></p> <p class=\"hdlb-left-nr\" onclick=\"OpenSHYJ('" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "')\">" + SHJGHTML + "</p><p><button onclick=\"DeleteSW('" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "','" + data.rows[i].ISXGFW + "')\">删除</button></p></div>";*/

                            if (data.rows[i].IsFQR != "1") {
                                html += "<span>当前步骤:" + data.rows[i].DQSHBZ + "</span ></p> <p class=\"hdlb-left-nr\" onclick=\"OpenSHYJ('" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "')\">" + SHJGHTML + "</p></div>";
                                html += " </div>";
                            } else {
                                var textHtml = "送审";
                                if (data.rows[i].DQSHBZ != "开始") {
                                    textHtml = data.rows[i].DQSHBZ;
                                }
                                html += "<span>当前步骤:" + data.rows[i].DQSHBZ + "</span ></p> <p class=\"hdlb-left-nr\" onclick=\"OpenSHYJ('" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "')\">" + SHJGHTML + "</p><p><button onclick=\"OpenHTML('0','" + data.rows[i].DJID + "','" + data.rows[i].DJLX + "','" + data.rows[i].XSDM + "','" + data.rows[i].IsFQR + "','" + data.rows[i].SHZTNAME + "','0')\">" + textHtml + "</button></p></div>";
                                html += " </div>";
                            }

                        }
                        $("#divHDLB").html(html);
                        $("#moreA").show();
                    } else {
                        $("#divHDLB").html("<h1 style='font-size: 18px; color:red;text-align: center;'>暂无数据！</h1>");
                        $("#moreA").hide();
                    }
                }
            });
        }
        //事务打开详情
        function OpenHTML(winshid, DJID, DJLX, XSDM, IsFQR, SHJG, IsTH) {
            //var OpenLayer = layer.open({//查询到数据后打开窗口并把数据传到页面
            //    type: 2,
            //    title: '详情',
            //    closeBtn: 1,
            //    shadeClose: true,
            //    btnAlign: 'c',
            //    //skin: 'layui-layer-rim', //加上边框
            //    area: ['90%', '80%'],//宽高
            //    content: 'XGFW_XSXQ.html?DJID=' + DJID + '&winshid=' + winshid + '&DJLX=' + escape(DJLX) + '&XSDM=' + XSDM + '&IsFQR=' + IsFQR + '&SHJG=' + escape(SHJG)
            //});
            window.location.href = 'XGFW_XSXQ.html?DJID=' + DJID + '&winshid=' + winshid + '&DJLX=' + escape(DJLX) + '&XSDM=' + XSDM + '&IsFQR=' + IsFQR + '&IsTH=' + IsTH + '&SHJG=' + escape(SHJG) + '&UserAgent=' + UserAgent + '&PDLXID=' + PDLXID + '&PDLXMC=' + escape(PDLXMC) + '&KZDM=' + KZDM;//后三个参数 是传回来要用的



        }
        //加载更多
        function LoadMore() {
            if ((currectPage + 1) > totalPage) {
                currectPage = totalPage;
                alert("暂无更多！");
            } else {
                currectPage += 1;
                LoadSW();
            }
        }
        //加载意见
        function OpenSHYJ(DJID, DJLX) {
            $.ajax({
                type: "GET",
                data: { DJID: DJID, DJLX: DJLX },
                url: '../json/3.json',
                dataType: "json",
                async: true,
                success: function (data) {
                    var html = "";
                    if (data.total > 0) {
                        var Color = "";
                        for (var i = 0; i < data.total; i++) {
                            if (data.rows[i].SHJG == "3") {
                                Color = 'style="color:green;"';
                            } else if (data.rows[i].SHJG == "4") {
                                Color = 'style="color:red;"';
                            } else {
                                Color = "";
                            }
                            html += "<div class=\"hdlb-content clearfix\"><div class=\"hdlb-left fl\" style=\"width:100%;\">";
                            html += "<p class=\"hdlb-left-title\">审核步骤： " + data.rows[i].DQSHBZ + "</p>";
                            html += "<p class=\"hdlb-left-nr\"><span>审 核 人 ： " + data.rows[i].XM + "</span></p>";
                            html += "<p class=\"hdlb-left-nr\">审核结果： <span " + Color + ">" + data.rows[i].SHJGNAME + "</span></p>";
                            html += "<p class=\"hdlb-left-nr\"><span>审核时间： " + data.rows[i].SHRQ + "</span></p>";
                            html += "<p class=\"hdlb-left-nr\"><span>审核意见： " + data.rows[i].SHYJ + "</span ></p>";
                            html += "</div></div>";
                        }
                    }
                    $("#divSHYJ").html(html);
                    var OpenLayer = layer.open({//查询到数据后打开窗口并把数据传到页面
                        type: 1,
                        title: '审核详情',
                        closeBtn: 1,
                        shadeClose: true,
                        btnAlign: 'c',
                        //skin: 'layui-layer-rim', //加上边框
                        area: ['90%', '80%'],
                        content: $("#sectionSHYJ").html()
                    });
                }
            });
        }
        //function CloseLayui() {
        //    layer.closeAll();
        //    LoadSW();
        //}
     
        //删除事务里的数据
        function DeleteSW(DJID, DJLX, ISXGFW) {
            if (confirm("确认删除?")) {
                $.ajax({
                    type: "POST",
                    data: { DJID: DJID, DJLX: DJLX, ISXGFW: ISXGFW },
                    url: 'http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=DeleteSW',
                    dataType: "text",
                    async: true,
                    success: function (data) {
                        if (data == "none") {
//                           alert("未找到删除数据!");
                            alert("删除成功！");
                            删除后的事务();
                        }
                        else if (data == "noDelete") {
                            alert("已审核通过，不能删除!");
                        } else if (data == "no") {
                            alert("删除失败！");
                        } else {
                            alert("删除成功！");
                            LoadSW();
                        }
                    }
                })
            }
        }
        function Back() {
            var url = document.referrer;//上一层的页面地址
            url = url.substring(0, url.indexOf("?"));
            if (url.indexOf("XGFW_XSXQ.html") > -1) {//上一个页面是详情页 防止无限循环跳转
                window.history.go(-3);
            } else {
                window.history.go(-1);
            }
        }




        function _index(el) {
            var index = 0;
            if (!el || !el.parentNode) {
                return -1;
            }
            while (el && (el = el.previousElementSibling)) {
                index++;
            }
            return index;
        }
        //学生选择
        function OpenChoiseXS() {
            var title = "选择学生";
            var w = 800;
            var h = 504;
            $("#SaveChoiseXS").window({
                title: title,
                width: w,
                height: h,
                maximizable: false,
                draggable: false,
                minimizable: false,
                collapsible: false,
                modal: true,
                href: 'XGFW_ChooseStudent.html',
                onLoad: function () {
                    LoadAddXSGv(); //加载权限GV
                }
            });
            $("#SaveChoiseXS").window('open');
            $("#SaveChoiseXS").window('center');
        }

        function LoadAddXSGv() {
            //设置默认样式
            $.messager.defaults = { ok: "确认", cancel: "取消", width: 300, height: "auto", minHeight: 150, modal: true, collapsible: false, minimizable: false, maximizable: false, resizable: false };
            //加载数据表格
            $('#XSdg').datagrid({
                fit: true, //自适应大小
                pageSize: 20, //页面条数
                striped: true, //是否显示斑马线效果。
                rownumbers: true, //如果为true，则显示一个行号列。
                fitColumn: false, //允许表格自动缩放，以适应父容器
                pagination: true, //如果为true，则在DataGrid控件底部显示分页工具栏。
                fitColumns: false, //真正的自动展开/收缩列的大小，以适应网格的宽度，防止水平滚动。
                singleSelect: true, //如果为true，则只允许选择一行。
                autoRowHeight: false, //定义设置行的高度，根据该行的内容。设置为false可以提高负载性能。
                checkOnSelect: true, //设置为 true，当用户点击某一行时，则会选中/取消选中复选框。设置为 false 时，只有当用户点击了复选框时，才会选中/取消选中复选框
                selectOnCheck: true, //设置为 true，点击复选框将会选中该行。设置为 false，选中该行将不会选中复选框
                nowrap: false, //设置为true，当数据长度超出列宽时将会自动截取
                loadMsg: "正在加载，请稍后......", //在从远程站点加载数据的时候显示提示消息。
                url: 'http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=ChooseStudent',
                //排序
                onSortColumn: function (sort, order) {
                    $("#XSdg").datagrid('load', {
                        sort: sort,
                        order: order,
                        searchercontent: $('#XSsearcher').textbox('getValue'), //搜索框
                        txtXSDWMC: $('#txtXSDWMC').combobox('getValue'), //院系
                        txtXSRXNF: $('#txtXSRXNF').combobox('getValue'), //年级
                        txtXSZYMC: $('#txtXSZYMC').combobox('getValue'), //专业
                        txtXSBJMC: $('#txtXSBJMC').combobox('getValue'), //班级
                        txtXSXH: $('#txtXSXH').textbox('getValue'), //学号
                        txtXSXM: $('#txtXSXM').textbox('getValue'), //姓名
                        txtXSXBDMMC: $('#txtXSXBDMMC').combobox('getValue') //性别
                    })
                },
                onLoadSuccess: function (data) {
                    $('#XSdg').datagrid('getPager').pagination({ showRefresh: false });
                }
            });
            //加载分页
            $('#XSdg').datagrid('getPager').pagination({
                pageList: [10, 20, 30, 40, 50], //可以设置每页记录条数的列表
                displayMsg: '当前显示从第{from}条到第{to}条，共{total}条记录',
                beforePageText: '第',
                afterPageText: '页  共{pages}页',
                onSelectPage: function (pageNumber, pageSize) {
                    var state = $('#XSdg').data('datagrid');
                    var opts = state.options;
                    opts.pageNumber = pageNumber;
                    opts.pageSize = pageSize;
                    getXSData(pageNumber, pageSize);
                }
            });
            function getXSData(page, rows) {
                $("#XSdg").datagrid("loading");
                $.post('http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=ChooseStudent', {
                    page: page,
                    rows: rows,
                    searchercontent: $('#XSsearcher').textbox('getValue'), //搜索框
                    txtXSDWMC: $('#txtXSDWMC').combobox('getValue'), //院系
                    txtXSRXNF: $('#txtXSRXNF').combobox('getValue'), //年级
                    txtXSZYMC: $('#txtXSZYMC').combobox('getValue'), //专业
                    txtXSBJMC: $('#txtXSBJMC').combobox('getValue'), //班级
                    txtXSXH: $('#txtXSXH').textbox('getValue'), //学号
                    txtXSXM: $('#txtXSXM').textbox('getValue'), //姓名
                    txtXSXBDMMC: $('#txtXSXBDMMC').combobox('getValue') //性别
                }, function (result) {
                    result = JSON.parse(result);
                    $("#XSdg").datagrid("loadData", result);
                    $("#XSdg").datagrid("loaded");
                })
            }
            //按班级或姓名查询
            $('#XSsearcher').searchbox({
                searcher: function (value, name) {
                    $("#XSdg").datagrid('load', {
                        searchercontent: value,
                        txtXSDWMC: $('#txtXSDWMC').combobox('getValue'), //院系
                        txtXSRXNF: $('#txtXSRXNF').combobox('getValue'), //年级
                        txtXSZYMC: $('#txtXSZYMC').combobox('getValue'), //专业
                        txtXSBJMC: $('#txtXSBJMC').combobox('getValue'), //班级
                        txtXSXH: $('#txtXSXH').textbox('getValue'), //学号
                        txtXSXM: $('#txtXSXM').textbox('getValue'), //姓名
                        txtXSXBDMMC: $('#txtXSXBDMMC').combobox('getValue') //性别
                    })
                },
                prompt: '请输入班级或姓名...'
            });
            //绑定高级搜索的下拉框
            $('#txtXSDWMC').combobox({
                url: 'http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=BandYX',
                valueField: 'DWDM',
                textField: 'DWMC',
                onChange: function (newVal, oldVal) {
                    if (newVal != '' && newVal != "请选择") {
                        if (newVal != oldVal) {
                            //加载专业名称下拉框
                            var Nj = $('#txtXSRXNF').combobox('getValue');
                            $('#txtXSZYMC').combobox({
                                url: 'http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=BandZY&DWDM=' + newVal + "&Nj=" + Nj,
                                valueField: 'ZYDM',
                                textField: 'ZYMC',
                                onChange: function (newValc, oldValc) {
                                    if (newValc != '' && newValc != "请选择") {
                                        if (newValc != oldValc) {
                                            //加载专业名称下拉框
                                            var rxnf = $('#txtXSRXNF').combobox('getValue');
                                            $('#txtXSBJMC').combobox({
                                                url: 'http://117.169.48.109:8089/ZZGL/ashx/jzxj_jzxjgl.ashx?type=BandBJ&ZYDM=' + newValc + "&RXNF=" + rxnf,
                                                valueField: 'BJDM',
                                                textField: 'BJMC'
                                            });
                                        }
                                    }
                                    else {
                                        $('#txtXSBJMC').combobox('loadData', {});
                                        $('#txtXSBJMC').combobox('setValue', '请选择'); //班级
                                    }
                                }
                            });
                        }
                    }
                    else {
                        $('#txtXSZYMC').combobox('loadData', {});
                        $('#txtXSZYMC').combobox('setValue', '请选择'); //专业
                    }
                }
            });
            //加载年级下拉框
            $('#txtXSRXNF').combobox({
                url: 'http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=BandNJ',
                valueField: 'RXNF',
                textField: 'RXNF',
                onChange: function (newVal, oldVal) {
                    if (newVal != '' && newVal != "请选择") {
                        if (newVal != oldVal) {
                            //加载专业名称下拉框
                            var yx = $('#txtXSDWMC').combobox('getValue');
                            $('#txtXSZYMC').combobox({
                                url: 'http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=BandZY&DWDM=' + yx + "&Nj=" + newVal,
                                valueField: 'ZYDM',
                                textField: 'ZYMC',
                                onChange: function (newValc, oldValc) {
                                    if (newValc != '' && newValc != "请选择") {
                                        if (newValc != oldValc) {
                                            //加载专业名称下拉框
                                            var zy = $('#txtXSZYMC').combobox('getValue');
                                            var rx = $('#txtXSRXNF').combobox('getValue');
                                            $('#txtXSBJMC').combobox({
                                                url: 'http://117.169.48.109:8089/weixinYX/ashx/XGFW.ashx?type=BandBJ&ZYDM=' + zy + "&RXNF=" + rx,
                                                valueField: 'BJDM',
                                                textField: 'BJMC'
                                            });
                                        }
                                    }
                                    else {
                                        $('#txtXSBJMC').combobox('loadData', {});
                                        $('#txtXSBJMC').combobox('setValue', '请选择'); //班级
                                    }
                                }
                            });
                        }
                    }
                    else {
                        $('#txtXSZYMC').combobox('loadData', {});
                        $('#txtXSZYMC').combobox('setValue', '请选择'); //专业
                    }
                }
            });
        }
        function formatRadio(val, row, index) {
            return '<input type="radio" onclick="onSelect(\'' + row.XSDM + '\',\'' + row.XM + '\',\'' + row.XH + '\',\'' + row.XBDMMC + '\',\'' + row.ZYMC + '\',\'' + row.BJMC + '\',\'' + row.DWMC + '\');"  name="RD"/>';
        }
        //学生高级搜索
        //查询
        function XSdoSelect() {
            $("#XSdg").datagrid('load', {
                searchercontent: $('#XSsearcher').textbox('getValue'), //搜索框
                txtXSDWMC: $('#txtXSDWMC').combobox('getValue'), //院系
                txtXSRXNF: $('#txtXSRXNF').combobox('getValue'), //年级
                txtXSZYMC: $('#txtXSZYMC').combobox('getValue'), //专业
                txtXSBJMC: $('#txtXSBJMC').combobox('getValue'), //班级
                txtXSXH: $('#txtXSXH').textbox('getValue'), //学号
                txtXSXM: $('#txtXSXM').textbox('getValue'), //姓名
                txtXSXBDMMC: $('#txtXSXBDMMC').combobox('getValue') //性别
            });
            $('#XSSelectDiv').window('close');
        }
        //重置
        function XSSelectClear() {
            $("#XSformSelect").form("clear");
            $('#txtXSDWMC').combobox('setValue', "请选择");  //院系
            $('#txtXSRXNF').combobox('setValue', "请选择");  //年级
            $('#txtXSZYMC').combobox('setValue', "请选择");  //专业
            $('#txtXSBJMC').combobox('setValue', "请选择");  //班级
        }
        function onSelect(XSDM, XM, XH, XBDMMC, ZYMC, BJMC, DWMC) {
            $("input[name='xsdm']").val(XM);
            $("input[name='xsdm']").attr('xsdm', XSDM);

            var chooses = $("input[name='xsdm']").attr('choose').split('_');
            $("input[name='" + chooses[0] + "']").val(XM);
            $("input[name='" + chooses[1] + "']").val(XH);
            $("input[name='" + chooses[2] + "']").val(XBDMMC);
            $("input[name='" + chooses[3] + "']").val(ZYMC);
            $("input[name='" + chooses[4] + "']").val(BJMC);
            $("input[name='" + chooses[5] + "']").val(DWMC);

            $("#SaveChoiseXS").window('close');
        }

        /*图片上传*/
        var imgDivName = "";
        function ChooseImage(obj) {
            $("#headPortraitUpload").change(function () {
                cutImageBase64(this);
            })
            imgDivName = $(obj).parent().parent()[0].id;
            document.getElementById("headPortraitUpload").click();
        }
        function cutImageBase64(obj) {
            if (window.FileReader) {
                var fileReader = new FileReader();
                fileReader.readAsDataURL(obj.files[0]);
                fileReader.onloadend = function (e) {
                    $("input[name='" + imgDivName.substring(4) + "']").val(fileReader.result);
                    $("#" + imgDivName + ">div").html('<img src="' + fileReader.result + '" width="' + $("#" + imgDivName + ">div").width() + '" height="' + $("#" + imgDivName + ">div").height() + '" />');
                }
            }
        }
        //图片删除
        function imgDel(obj) {
            $(obj).prev().html('<p onclick = "ChooseImage(this)">+</p>');
            $("input[name='" + imgDivName.substring(4) + "']").val('');
            document.getElementById("headPortraitUpload").value = "";
            imgDivName = "";
        }
    </script>
    <script type="text/javascript" src="http://117.169.48.109:8089/js/hammer.min.js"></script>
    <script>
        var reqAnimationFrame = (function () {
            return window[Hammer.prefixed(window, 'requestAnimationFrame')] || function (callback) {
                window.setTimeout(callback, 1000 / 60);
            };
        })();

        var el = document.querySelector("#div_panel");

        var START_X = -el.offsetWidth;// Math.round((window.innerWidth - el.offsetWidth) / 2);
        var START_Y = -el.offsetHeight;// Math.round((window.innerHeight - el.offsetHeight) / 2);

        var ticking = false;
        var transform;   //图像效果
        var timer;
        var initAngle = 0;  //旋转角度
        var initScale = 0.5;  //放大倍数



        /**
        第二次进入拖拽时  delta位移重置
        移动时 初始位置startxy不动。delta增加
        */
        function onPan(ev) {
            var tables = document.getElementById("div_panel").getElementsByTagName("table");
            if (tables.length == 0) {
                return false;
            }
            if (!ev.isFinal) {
                el.className = '';
                console.log(START_X + "  " + START_Y + " |  " + ev.deltaX + "  " + ev.deltaY);
                transform.translate = {
                    x: START_X + ev.deltaX,
                    y: START_Y + ev.deltaY
                };
                requestElementUpdate();
            }
        }

        function onPinch(ev) {
            var tables = document.getElementById("div_panel").getElementsByTagName("table");
            if (tables.length == 0) {
                return false;
            }
            if (ev.type == 'pinchstart') {
                initScale = transform.scale || 1;
            }
            el.className = '';
            transform.scale = initScale * ev.scale;
            requestElementUpdate();
        }

        //旋转相关
        var preAngle = 0;
        var tempAngleFlag = 0;
        var deltaAngle = 0;
        var startRotateAngle = 0;

        function onRotate(ev) {
            var tables = document.getElementById("div_panel").getElementsByTagName("table");
            if (tables.length == 0) {
                return false;
            }
            //点下第二个触控点时触发
            if (ev.type == 'rotatestart') {
                startRotateAngle = ev.rotation;
                tempAngleFlag = 0;
            }
            if (ev.type == 'rotatemove') {
                if (tempAngleFlag == 0) {
                    preAngle = startRotateAngle;
                    tempAngleFlag++;
                } else {
                    deltaAngle = ev.rotation - preAngle;
                    el.className = '';
                    transform.rz = 1;  //非0  垂直xy轴
                    transform.angle = initAngle + deltaAngle;
                    requestElementUpdate();
                }
            }

            //旋转结束  记录当前图片角度
            if (ev.type == 'rotateend') {
                initAngle = transform.angle;
            }
        }


        function updateElementTransform() {
            var value = [
                'translate3d(' + transform.translate.x + 'px, ' + transform.translate.y + 'px, 0)',
                'scale(' + transform.scale + ', ' + transform.scale + ')',
                'rotate3d(' + transform.rx + ',' + transform.ry + ',' + transform.rz + ',' + transform.angle + 'deg)'
            ];

            value = value.join(" ");
            el.style.webkitTransform = value;  /*为Chrome/Safari*/
            el.style.mozTransform = value; /*为Firefox*/
            el.style.transform = value; /*IE Opera?*/
            ticking = false;
        }

        function requestElementUpdate() {
            if (!ticking) {
                reqAnimationFrame(updateElementTransform);
                ticking = true;
            }
        }

        /**
        初始化设置
        */
        function resetElement() {
            var tables = document.getElementById("div_panel").getElementsByTagName("table");
            if (tables.length == 0) {
                return false;
            }
            mc = new Hammer.Manager(el);   //用管理器  可以同时触发旋转 拖拽  移动
            //var mc = new Hammer(el);	      //旋转和移动互斥
            /**
            ev.srcEvent.type  touchstart  touchend touchmove
            ev.deltaX  手势移动位移变量
            */
            mc.add(new Hammer.Pan({ threshold: 0, pointers: 0 }));
            mc.add(new Hammer.Rotate({ threshold: 0 })).recognizeWith(mc.get('pan'));
            mc.add(new Hammer.Pinch({ threshold: 0 })).recognizeWith([mc.get('pan'), mc.get('rotate')]);
            //结束时做一些处理
            mc.on("hammer.input", function (ev) {
                var tables = document.getElementById("div_panel").getElementsByTagName("table");
                if (tables.length == 0) {
                    return false;
                }
                if (ev.isFinal) {
                    console.log(START_X + "  " + transform.translate.x + "   " + ev.deltaX);
                    START_X = transform.translate.x;
                    START_Y = transform.translate.y;
                }

            });
            mc.on("panstart panmove", onPan);
            //mc.on("rotatestart rotatemove rotateend", onRotate);
            mc.on("pinchstart pinchmove", onPinch);

            el.className = 'animate';
            transform = {
                translate: { x: START_X, y: START_Y },
                scale: 0.4,
                angle: 0,
                rx: 0,
                ry: 0,
                rz: 0
            };
            requestElementUpdate();
        }
            //hammertime.get('rotate').set({ enable: false });

      
    </script>
</body>
</html> 